import request from './request'

// 获取分享列表
export function getShareList(params) {
  return request({
    url: '/api/shares',
    method: 'get',
    params
  })
}

// 获取分享详情
export function getShareDetail(id) {
  return request({
    url: `/api/shares/${id}`,
    method: 'get'
  })
}

// 创建分享
export function createShare(data) {
  return request({
    url: '/api/shares',
    method: 'post',
    data
  })
}

// 更新分享
export function updateShare(id, data) {
  return request({
    url: `/api/shares/${id}`,
    method: 'put',
    data
  })
}

// 删除分享
export function deleteShare(id) {
  return request({
    url: `/api/shares/${id}`,
    method: 'delete'
  })
}

// 批量删除分享
export function batchDeleteShares(ids) {
  return request({
    url: '/api/shares/batch-delete',
    method: 'post',
    data: { ids }
  })
}

// 获取分享统计数据
export function getShareStatistics() {
  return request({
    url: '/api/share/statistics',
    method: 'get'
  })
}

// 获取热门分享
export function getHotShares(params) {
  return request({
    url: '/api/share/hot',
    method: 'get',
    params
  })
}

// 获取分享访问记录
export function getShareAccessRecords(shareId, params) {
  return request({
    url: `/api/shares/${shareId}/access-records`,
    method: 'get',
    params
  })
}

// 更新分享状态
export function updateShareStatus(id, status) {
  return request({
    url: `/api/shares/${id}/status`,
    method: 'put',
    data: { status }
  })
}

// 获取用户分享列表
export function getUserShares(userId, params) {
  return request({
    url: `/api/share/user/${userId}`,
    method: 'get',
    params
  })
}

// 获取分享分类列表
export function getShareCategories() {
  return request({
    url: '/api/share/categories',
    method: 'get'
  })
}

// 获取分享标签列表
export function getShareTags() {
  return request({
    url: '/api/share/tags',
    method: 'get'
  })
}